﻿@using Vcare.Properties
@model Vcare.Models.Members

@using (Html.BeginForm("Edit", "Members", FormMethod.Post, new { name="frmEditMember" }))
{
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Edit @Model.Firstname @Model.Lastname</legend>

        @Html.HiddenFor(model => model.MembersID)
        @Html.HiddenFor(model => model.Title)
        @Html.HiddenFor(model => model.CallCentreID)
        @Html.HiddenFor(model => model.ContactDate)

        <div class="editor-label">
            <label style="font-family: 'Trebuchet MS'; font-style: italic; color: #800000; font-size: 14px">Contact Date @Model.ContactDate.ToShortDateString()</label>
        </div>
        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Phone)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Phone)
            @Html.ValidationMessageFor(model => model.Phone)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Title)
        </div>
        <div class="editor-field">
            @Html.DropDownList("Titles", null, new { name="Title" })
            @Html.ValidationMessageFor(model => model.Title)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Firstname)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Firstname)
            @Html.ValidationMessageFor(model => model.Firstname)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Lastname)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Lastname)
            @Html.ValidationMessageFor(model => model.Lastname)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.housenumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.housenumber)
            @Html.ValidationMessageFor(model => model.housenumber)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Address)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Town)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Town)
            @Html.ValidationMessageFor(model => model.Town)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.County)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.County)
            @Html.ValidationMessageFor(model => model.County)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Postcode)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Postcode)
            @Html.ValidationMessageFor(model => model.Postcode)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Email)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.MembershipID)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.MembershipID)
            @Html.ValidationMessageFor(model => model.MembershipID)
        </div>

        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.PaymentType)
        </div>
        <div class="editor-field">
            @Html.DropDownList("PaymentType")
            @Html.ValidationMessageFor(model => model.PaymentType)
        </div>

        <div id="directdebit">
        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.AccountNo)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.AccountNo)
            @Html.ValidationMessageFor(model => model.AccountNo)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Sortcode)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Sortcode)
            @Html.ValidationMessageFor(model => model.Sortcode)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.AccountName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.AccountName)
            @Html.ValidationMessageFor(model => model.AccountName)
        </div>
        </div>

        <div id="creditcard">
        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.CardType)
        </div>
        <div class="editor-field">
            @Html.DropDownList("CardType");
            @Html.ValidationMessageFor(model => model.CardType)
        </div>
        <div class="spacer"></div>
        <div class="editor-label maestro">
            @Html.LabelFor(model => model.StartDate)
        </div>
        <div class="editor-field maestro">
            @Html.EditorFor(model => model.StartDate)
            @Html.ValidationMessageFor(model => model.StartDate)
        </div>

        <div class="editor-label maestro">
            @Html.LabelFor(model => model.IssueNumber)
        </div>
        <div class="editor-field maestro">
            @Html.EditorFor(model => model.IssueNumber)
            @Html.ValidationMessageFor(model => model.IssueNumber)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CardHoldersName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CardHoldersName)
            @Html.ValidationMessageFor(model => model.CardHoldersName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CardNumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CardNumber)
            @Html.ValidationMessageFor(model => model.CardNumber)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CVCNumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CVCNumber)
            @Html.ValidationMessageFor(model => model.CVCNumber)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ExpiryDate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ExpiryDate)
            @Html.ValidationMessageFor(model => model.ExpiryDate)
        </div>
        </div>

        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.PricePlan)
        </div>
        <div class="editor-field">
            @Html.DropDownList("PricePlan")
            @Html.ValidationMessageFor(model => model.PricePlan)
        </div>

        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Multiroom)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Multiroom)
            @Html.ValidationMessageFor(model => model.Multiroom)
        </div>

        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.CommentsOnBoxType)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CommentsOnBoxType)
            @Html.ValidationMessageFor(model => model.CommentsOnBoxType)
        </div>
        @if (this.User.IsInRole(ApplicationRoles.CallCentreQC))
        {
        <div class="editor-label">
            @Html.LabelFor(model => model.QAd)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.QAd)
            @Html.ValidationMessageFor(model => model.QAd)
        </div>
        }
        <div class="spacer"></div>
        <p>
            <input type="submit" value="Save" style="width:100px;"/>
        </p>
    </fieldset>
}
<div class="spacer"></div>
<div>
    @Html.ActionLink("Back to List", "Index")
</div>

<script type="text/javascript">
    $(document).ready(function () {

        $("#Titles").val("@(Model.Title)");

        $("#PaymentOption").val("@(Model.PaymentOption)");

        $("#ExpiryDate").mask("9999");
        $("#StartDate").mask("9999");

        $("#Titles").change(function () {
            $("#Title").val($(this).val());
        });

        if ($('#PaymentType').val()=="Direct Debit")
        {
            $("#creditcard").hide();
        }
        else
        {
            $("#directdebit").hide();
        }

        $('#PaymentType').change(function () {
            $("#creditcard").toggle();
            $("#directdebit").toggle();
        });
    });
</script>

